package com.lej.core.router

import android.app.Activity
import com.alibaba.android.arouter.facade.Postcard
import com.alibaba.android.arouter.launcher.ARouter
import com.lej.core.base.currentActivity

interface CRouter {
    companion object {
        const val main = "/app_main/main"
        const val newMain = "/app_home/newMain"
        const val unityhouse = "/app_main/unityhouse"
        const val newmy = "/app_my/new_my"
        const val newchat = "/app_chat/new_chat"


        //HOME
        const val launcher = "/home/launcher"
        const val newLauncher = "/home/launcher"
        const val commercial = "/home/commercial"
        const val overview = "/home/overview"
        const val userInfo = "/home/userInfo"
        const val settings = "/settings/settings"
        const val about = "/settings/about"
        const val collect = "/home/collect"
        const val coupons = "/home/coupons"
        const val privilege = "/home/privilege"
        const val notify = "/home/notify"
        const val rank = "/home/rank"
        const val rank2 = "/home/rank2"
        const val myHome = "/home/myHome"
        const val nft = "/home/myHome"
        const val nftDetail = "/home/nftDetail"
        const val nftPayDetail = "/home/nftPayDetail"
        const val nftPayResultDetail = "/home/nftPayResultDetail"

        //pay
        const val payChoose = "/home/payChoose"

        //flutter
        const val flutter = "/flutter/activity"
        const val vip = "/my/vip"
        const val packages = "/my/packages"
        const val infoEdit = "/my/infoEdit"
        const val photoListEdit = "/my/photoListEdit"
        const val checkStatus = "/my/checkStatus"
        const val qaDetail = "/my/qaDetail"
        const val qaList = "/my/qaList"

        const val myLike = "/my/myLike"

        const val shareNative = "/my/shareNative"


        //LOGIN
        const val login = "/login/login"
        const val guardianSpirit = "/login/guardianSpirit"
        const val testt = "/login/test"
        const val bindPhone = "/login/bindPhone"
        const val countryCodeSelect = "/login/countryCodeSelect"
        const val chatLogin = "/login/chatLogin"
        const val studentCard = "/register/studentCard" //学历认证
        const val head = "/register/head"

        const val editUserInfo = "/register/editUserInfo"//完善用户资料

        //face
        const val face = "/face/check"

        //chat
        const val p2pMulti = "/nim_chat/p2pMulti"
        const val p2p = "/nim_chat/p2p"

        //comm
        const val webView = "/comm/webView"
        const val webFragment = "/comm/webFragment"

        const val pushDispatcher = "/provider/push"

        //publish
        const val publishAct = "/publish/publishAct"
        const val selectPushTag = "/publish/selectPushTag"
        const val publishLimit = "/publish/limit"
        const val publishAddLink = "/publish/addLink"
        const val publishFinish = "/publish/finish"

        //interact
        const val interactFra = "/interact/interact"
        const val interactSearch = "/interact/search"
        const val interactPerson = "/interact/person"
        const val interactPersonKnowMe = "/interact/person_knowMe"
        const val interactPersonProduct = "/interact/person_product"

        //my
        const val mySet = "/my/set"
        const val myMsgLogout = "/my/myMsgLogout"

        const val myAbout = "/my/about"
        const val myBalance = "/my/balance"
        const val mySettings = "/my/settings"
        const val myMessage = "/my/myMessage"
        const val mySpace = "/my/space"
        const val myCollect = "/my/collect"
        const val myService = "/my/service"
        const val myInformation = "/my/myInformation"

        //home
        const val homePublish = "/home/publish"

        //ar
        const val arHome = "/ar/arHome"


        fun String.navigation(
            activity: Activity? = null,
            reqCode: Int = -1,
            block: Postcard.() -> Unit = {}
        ) {
            ARouter.getInstance().build(this)
                .withTransition(android.R.anim.fade_in, android.R.anim.fade_out)
                .also(block)
                .navigation(activity ?: currentActivity, reqCode)
        }

        fun String.route(param: Pair<String, String?>, activity: Activity? = null) {
            ARouter.getInstance().build(this)
                .withTransition(android.R.anim.fade_in, android.R.anim.fade_out)
                .also { it.withString(param.first, param.second) }
                .navigation(activity ?: currentActivity)
        }
    }
}